---
title: Select
description: Displays a list of options for the user to pick from—triggered by a button.
kobalte: https://kobalte.dev/docs/core/components/select
---

<ComponentPreview name="select-demo" />

## Installation

<Tabs defaultValue="cli">

<TabsList>
  <TabsTrigger value="cli">CLI</TabsTrigger>
  <TabsTrigger value="manual">Manual</TabsTrigger>
</TabsList>

<TabsContent value="cli">

```bash
npx solidui-cli@latest add select
```

</TabsContent>

<TabsContent value="manual">
<Steps>

<Step>Install the following dependencies: </Step>

```bash
pnpm install @kobalte/core solid-icons
```

<Step>Copy and paste the following code into your project: </Step>

<ComponentSource name="select" />

</Steps>
</TabsContent>

</Tabs>

## Usage

```tsx
import {
  Select,
  SelectContent,
  SelectItem,
  SelectTrigger,
  SelectValue
} from "~/components/ui/select"
```

```tsx
const [value, setValue] = createSignal("")
<Select
    value={value()}
    onChange={setValue}
    options={["Apple", "Banana", "Blueberry", "Grapes", "Pineapple"]}
    placeholder="Select a fruit…"
    itemComponent={(props) => <SelectItem item={props.item}>{props.item.rawValue}</SelectItem>}
>
    <SelectTrigger aria-label="Fruit" class="w-[180px]">
        <SelectValue<string>>{(state) => state.selectedOption()}</SelectValue>
    </SelectTrigger>
    <SelectContent />
</Select>
```
